//
//  DefineConstant.m
//  ZhangShangDaXue
//
//  Created by Arthur Wang on 14-3-11.
//  Copyright 2014 cloud-loong. All rights reserved.
//
//


#import "DefineConstant.h"

extern NSString *EncodeObjectFromDic(NSDictionary *dic,NSString *key) {
    if (![dic isKindOfClass:[NSDictionary class]]) {
        return nil;
    }
    id temp = [dic objectForKey:key];
    NSString *value = @"";
    if (NotNilAndNull(temp))   {
        if ([temp isKindOfClass:[NSString class]]) {
            value = temp;
        }else if([temp isKindOfClass:[NSNumber class]]){
            value = [temp stringValue];
        }
        return value;
    }
    return nil;
}

extern id safeObjectAtIndex(NSArray *arr, NSInteger index)
{
    if (IsArrEmpty(arr)) {
        //SNAssert(!IsArrEmpty(arr));
        return nil;
    }

    if ([arr count]-1<index) {
        //SNAssert([arr count]-1<index);
        return nil;
    }

    return [arr objectAtIndex:index];
}
